
Public Class batchJobRequest


    Public Shared Function RequestInsert(ByVal username As String, ByVal reqid As String, ByVal jobid As String) As Long
        Dim strSQL As String
        strSQL = " insert into batch_req values('" & reqid & "','" & jobid & "',sysdate,'0','" & username & "') "
        Return myDBConn1.ORAExecute(strSQL)
    End Function

    Public Shared Function RequestParameterInsert(ByVal reqid As String, ByVal parameterNo As Integer, ByVal val As String) As Long
        Dim strSQL As String
        strSQL = " insert into batch_req_param values('" & reqid & "'," & parameterNo & ",'" & val & "') "
        Return myDBConn1.ORAExecute(strSQL)
    End Function

    Public Shared Function RequestFinish(ByVal reqid As String, ByVal status As String) As Long
        Dim strSQL As String
        strSQL = " update batch_req set status='" & status & "' where req_id ='" & reqid & "' "
        Return myDBConn1.ORAExecute(strSQL)
    End Function

    Public Shared Function SelectRequest() As DataTable
        Dim strSQL As String
        strSQL = " select * from batch_req where status in ('0','4') and username is not null "
        Return myDBConn1.myORATable(strSQL)
    End Function

    Public Shared Function SelectRequestParameter(ByVal reqid As String) As DataTable
        Dim strSQL As String
        strSQL = " select * from batch_req_param where req_id ='" & reqid & "' order by parameterno "
        Return myDBConn1.myORATable(strSQL)
    End Function

    Public Shared Function hareketList(ByVal username As String, ByVal jobid As String) As DataTable
        Dim strSQL As String
        strSQL = " select br.req_id,br.tarih,(select ack from batch_req_status where status=br.status) status,br.status statusno  from batch_req br where username='" & username & "' and job_id='" & jobid & "' "
        Return myDBConn1.myORATable(strSQL)
    End Function

    Public Shared Function select_customers_for_sms1() As DataTable
        Dim strSQL As String
        strSQL = " select customer_id,(select co_id from contract_all where customer_id=c.customer_id) from customer_all c  where custcode like '3.220.10%' and cstype='a' and cslevel=40 and tmcode=467 "
        strSQL = strSQL + " and custcode>'3.220.10.00.100119' and custcode<'3.220.10.00.101309' "

        ' strSQL = " select customer_id from customer_all c  where custcode like '3.%' and cstype='a' and cslevel=40 and rownum<101"

        Return myDBConn1.myORATable(strSQL)
    End Function

    Public Shared Function select_customers_for_sms2() As DataTable
        Dim strSQL As String
        strSQL = " select customer_id,(select co_id from contract_all where customer_id=c.customer_id) from customer_all c where custcode like '3.220.10%' and cstype='a' and cslevel=40 and tmcode=467 "
        strSQL = strSQL + " and custcode>'3.220.10.00.103309' and custcode<'3.220.10.00.104359' "
        'strSQL = " select customer_id from customer_all where custcode like '3.182.10%' and cstype='a' and cslevel=40 and tmcode=23 "
        'strSQL = " select customer_id from customer_all c  where custcode like '4.%' and cstype='a' and cslevel=40 and rownum<101"
        Return myDBConn1.myORATable(strSQL)
    End Function

    Public Shared Function select_customers_for_sms3() As DataTable
        Dim strSQL As String
        strSQL = " select customer_id,(select co_id from contract_all where customer_id=c.customer_id) from customer_all c  where custcode like '3.220.10%' and cstype='a' and cslevel=40 and tmcode=467 "
        strSQL = strSQL + " and custcode>'3.220.10.00.105311' and custcode<'3.220.10.00.106400' "

        Return myDBConn1.myORATable(strSQL)
    End Function

End Class


